import React from 'react';
import {
    Row,
    Col,
    Table,
} from 'antd';
import axios from 'axios';
import intercept from '../../utils/intercept';
import { config } from 'utils';
import './balance.less'

export default class chargeRecord extends React.Component{
    constructor(props){
        super(props);
        this.state={
            dataSource:[],
            loading:false,
            keyword:0,
        };

    };

componentDidMount(){
    this.getRecord();
};


getRecord(params={}){
    const token = sessionStorage.getItem("token");
    this.setState({ loading: true });
    const url = `${config.api}DailyStatics/GetChargeHistory`;
    // var keyword=typeof(params.keyword)==="undefined"
    // ?''
    // :params.keyword;
    axios.get(url, { headers: { Authorization: 'Bearer ' + token } }).then((data) => {
        //console.log(data)
        this.setState({ loading: false, dataSource: data.data.chargeHistory });
    })
    .catch(err => {
        intercept;
    })
}


render(){
    const scroll={
        y:600
    };
    const columns=[
        {
            title:'分销商',
            dataIndex:'trader',
            width:150
        },
        {
            title:'充值金额',
            dataIndex:'accountBalance',
            width:150
        },
        {
            title:'充值票数',
            dataIndex:'tkAmount',
            width:150
        },
        {
            title:'充值时间',
            dataIndex:'operTime',
            width:150
        }
    ];
    return(
        <div>
            <div>
                <Row gutter={8} style={{marginTop:'20px'}}>
                    <Col span={24}>
                      <Table
                         {...this.state}
                          border={true}
                          columns={columns}
                          scroll={scroll}
                      />
                    </Col>
                </Row>
            </div>
        </div>
    )
}


};
